<?php 

// determine which user to use
if(!is_null(App::$Current->Page->User))
	$user = App::$Current->Page->User;
else if(!is_null(App::$Current->User))								
	$user = App::$Current->User;
else
	$user = null;

if(!is_null($user))
{
	$this->User = $user;
	
	//$o = 'http://www.martiendejong.nl/images/martien.jpeg';
	// todo get user avatar
	$this->AvatarURL = '/img/guest.jpg';
	
	?>
	
	<div style="margin: -10px">
		<a href="/user/<?php print $this->User ?>" style="display: block; width: 150px; text-decoration: none">
			<img src="<?php print $this->AvatarURL ?>" width="150" border="0">
			<span style="display: block; color: #000; width: 150px; text-align: center; font-weight: bold"><?php print $this->User ?></span>
		</a>
	</div>
	
	<?php 
	$avg = RatingManager::GetAverages($user);
	?>		
	<div id="silverlightControlHost" style="margin-left: -35px; margin-right: -35px; margin-top: 35px;">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="200" height="200">
		  <param name="source" value="/xap/SocioRatingGraph.xap">
		  <param name="onError" value="onSilverlightError">
		  <param name="background" value="white">
		  <param name="minRuntimeVersion" value="3.0.40624.0">
		  <param name="autoUpgrade" value="true">
		  <param name="initParams" value="
		  friendly=<?php print $avg->friendly ?>, 
		  accurate=<?php print $avg->accurate ?>, 
		  helpful=<?php print $avg->helpful ?>, 
		  creative=<?php print $avg->creative ?>, 
		  trustworthy=<?php print $avg->trustworthy ?>, 
		  critical=<?php print $avg->critical ?>, 
		  gooder=<?php print $avg->gooder ?>">
		  <a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration:none">
			  <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none">
		  </a>
		</object>
		<iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
	</div>
	
	<?php 
	$numberRatings = RatingManager::CountRatingsToUser($user);
	?><a href="/user/to/<?php print $user ?>" style="text-decoration: none; color: #000"><span style="margin-top: -10px; margin-bottom: 20px; display:block;text-align: center; font-weight: bold"><?php print $numberRatings ?> <?php text('ratings') ?></span></a><?php 
}
else
{
	// todo
}
?>
<div style="margin-left: -10px; margin-right: -10px; margin-bottom: -15px">
	 <!-- AddThis Button BEGIN -->
	<div class="addthis_toolbox addthis_default_style ">
		<a class="addthis_button_preferred_1"></a>
		<a class="addthis_button_preferred_2"></a>
		<a class="addthis_button_preferred_3"></a>
		<a class="addthis_button_preferred_4"></a>
		<a class="addthis_button_compact"></a>
		<a class="addthis_counter addthis_bubble_style"></a>
	</div>
	<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4dee4abc25b17533"></script>
	<!-- AddThis Button END -->
</div>